<template>
<div>
  <h2>首页</h2>
  <el-tabs v-model="activeName" @tab-click="handleClick">
    <el-tab-pane label="新闻" name="news"></el-tab-pane>
    <el-tab-pane label="消息" name="message"></el-tab-pane>
  </el-tabs>
  <router-view></router-view>
</div>
</template>

<script>
export default {
name: "Foo",

  data(){
  return {
    activeName: "news"
  }
  },
  methods: {
  handleClick(){
    if (this.activeName === "news") {
      return this.$router.push("/foo/news")
    }else if (this.activeName === "message") {
      return this.$router.push("/foo/message")
    }
  }
  }
}
</script>

<style scoped>

</style>